package mythread.demo001;

public class MyThread12Test_stop3 {
    public static void main(String[] args) {
//        Thread thread = Thread.currentThread();
//        System.out.println(thread.getName() + "," + thread.getId());

        //1、退出标志  run后终止
        //2、stop（suspend、resume）过期
        //3、interrupt(只是打了一个标记)


        try {
            MyThread12 thread12 = new MyThread12();
            thread12.start();
            thread12.sleep(1000);
            thread12.interrupt();//并不是立即执行
            //Thread.currentThread().interrupt();
            //isInterrupted未清除中断状态，interrupted会清除中断状态
            System.out.println("is1-"+thread12.isInterrupted());
            System.out.println("is2-"+thread12.isInterrupted());
        } catch (InterruptedException e) {
            System.out.println("main catch");
            e.printStackTrace();
        }
        System.out.println("end");

    }
}
